package job2;
/*
通过实现java.lang.Runnable接口的方式创建一个新线程，要求main线程打印100次
”main”，新线程打印50次“new”。
 */
public class MYRunnable implements Runnable{
    @Override
    public void run() {
        for (int i = 1; i <= 50 ; i++) {
            String name = Thread.currentThread().getName();
            System.out.println("new线程打印第" + i + "次");
        }
        }

    public static void main(String[] args) {
        Runnable target = new MYRunnable();
        Thread t = new Thread(target,"threadA");
        t.start();
        for (int i = 1; i <= 100 ; i++) {
            System.out.println("main线程打印" + i+"次");
        }

    }
}
